UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ugA3vFWCE1s1xz8GW7guQSp0MisI6qfs+dGU90759wI=' 
WHERE 
  key_id = '7201c7b907a2d65f8b20451277bbcb437fd956f8d8ddc0d0ec7b085089d38c32' 
  AND (
    token = 'ugA3vFWCE1s1xz8GW7guQSp0MisI6qfs+dGU90759wI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038