UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vZEGIkq7e3WuLLzDLhuIgLXCmx+6VLOMIAPs7WBqOQw=' 
WHERE 
  key_id = '3943c3f1afdf680fc7f5bcf7203038d85fc9f2ebb22e162afa639653659a3dd6' 
  AND (
    token = 'vZEGIkq7e3WuLLzDLhuIgLXCmx+6VLOMIAPs7WBqOQw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00072