UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'zQBh0C3rQ9B+TFdNDD1hpFBBbvKHNk+ur/15mjKWAvA=' 
WHERE 
  key_id = 'a1b104c1c15b9ab1a2755d73809b42614e088afab7c12314fe6a7a08868cf47b' 
  AND (
    token = 'zQBh0C3rQ9B+TFdNDD1hpFBBbvKHNk+ur/15mjKWAvA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046