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

Query time 0.00032