UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'm78yfy3rG3LVO6S8h6xFsPiIfVcS3suX+xjLkOcbWzw=' 
WHERE 
  key_id = '8b1e0681055a531981b57e7a15de60c69064fc89b5c6b9cbbaf693bf84ec0a73' 
  AND (
    token = 'm78yfy3rG3LVO6S8h6xFsPiIfVcS3suX+xjLkOcbWzw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031