UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2HQMeDHPW1C0HaXT+e2cZSSNARtcJdj7Ga2Kj4JwRYU=' 
WHERE 
  key_id = '7734ce05a1eb1a213b5027f40c3608565c662580953b5044080dd118d5420bb4' 
  AND (
    token = '2HQMeDHPW1C0HaXT+e2cZSSNARtcJdj7Ga2Kj4JwRYU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029