UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rWQWhlrCO1QKds3thacgye6FK3qBUB5toiVPM9saqEw=' 
WHERE 
  key_id = '0cee092bb9e2666b139d64a9a994b5f63d4285fca94a7297cb7e488b539a9904' 
  AND (
    token = 'rWQWhlrCO1QKds3thacgye6FK3qBUB5toiVPM9saqEw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037