UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5uUIrSU0iepCdF+wpQcAcLJBQlAeMayawYOtRf37EN0=' 
WHERE 
  key_id = 'b5e667298ea7827e888ba22688057d9cabfc2bfb5661c2dda85fbf25b63993e9' 
  AND (
    token = '5uUIrSU0iepCdF+wpQcAcLJBQlAeMayawYOtRf37EN0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035