UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wfGOlZR4PQCk0zm6JMDVYHF7UrMFuOuc2WLdu2oBZLQ=' 
WHERE 
  key_id = '9e3300cd28e1339503b782de7beb70b23e9f566746f34d484ce5f2e060679811' 
  AND (
    token = 'wfGOlZR4PQCk0zm6JMDVYHF7UrMFuOuc2WLdu2oBZLQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017