UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kA1bh72Bf8ErKMREUqO9mjon4Q2xDN36e212CNw29Oc=' 
WHERE 
  key_id = '3299e6133833098e8fe34770cff296541805c1e32d510b7b699e7f8beaba6eb1' 
  AND (
    token = 'kA1bh72Bf8ErKMREUqO9mjon4Q2xDN36e212CNw29Oc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034