UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HxCBY/OVNh0W5UOtn82s1efINe6HFdA4v7POXvEl2wA=' 
WHERE 
  key_id = 'f62802b71b88b5559ea05d9685b093263b06b85c4a1cbdf2616f5d343e923b31' 
  AND (
    token = 'HxCBY/OVNh0W5UOtn82s1efINe6HFdA4v7POXvEl2wA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032