UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DjeMFmtXFBHnMXSjMqQBwBwYImwmZQaGTTuDsOke3ms=' 
WHERE 
  key_id = 'f85cb22d4c90f1eaf97ec37c2ff3f8907f984feb21a45b4498684cd34d021158' 
  AND (
    token = 'DjeMFmtXFBHnMXSjMqQBwBwYImwmZQaGTTuDsOke3ms=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021