UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'G8OPaqNQTHj6ch9o+tnkVk1zODRKHIl7gr1WJiAYJ3k=' 
WHERE 
  key_id = 'ee95ff9e82c25eaa031da6ca623734117b73003024c31f25912ed471cf9985fb' 
  AND (
    token = 'G8OPaqNQTHj6ch9o+tnkVk1zODRKHIl7gr1WJiAYJ3k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043