UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SzP9W5taa3KSysBeS4fq8g3A9268uRN0luvSpY/R7VU=' 
WHERE 
  key_id = 'aa8e2c4ffab38a6ed4ff20a53d1a7e8877a19845776521bdebbfe2182051709d' 
  AND (
    token = 'SzP9W5taa3KSysBeS4fq8g3A9268uRN0luvSpY/R7VU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027