UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'eA8G5HrtReO1zqn7VJq7Kl01Frb3dsz9HUf/BKAotts=' 
WHERE 
  key_id = 'ede9b57fbd7d71288a6d72626ae5efcc2eaa2f762c04cd177f165d36653d5105' 
  AND (
    token = 'eA8G5HrtReO1zqn7VJq7Kl01Frb3dsz9HUf/BKAotts=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030