UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jH7KsbL95MlpwOTAPtSdEh2zjDLy3OI/DIDWWN09/N8=' 
WHERE 
  key_id = 'a16bddc35b67be1358c8243c0632673080c8375c63c34360964c6f6112cbc0a8' 
  AND (
    token = 'jH7KsbL95MlpwOTAPtSdEh2zjDLy3OI/DIDWWN09/N8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00061