UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'zRgSphg6B/ohN6LH1nE1966P2tA6Qy1ZkT/+PrbhLTs=' 
WHERE 
  key_id = 'c8dec18bf954a40973034ac11d9c35a57ca161503f42d000188f739bbcd2dca2' 
  AND (
    token = 'zRgSphg6B/ohN6LH1nE1966P2tA6Qy1ZkT/+PrbhLTs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047