UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oX734P6wdDpPEhZt+G8JTDztdrQvJtsnsnsDcNpANvs=' 
WHERE 
  key_id = 'a79dba31eb6c6957970f67d611283609f35a4669459e348b982dee328e7086c9' 
  AND (
    token = 'oX734P6wdDpPEhZt+G8JTDztdrQvJtsnsnsDcNpANvs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00063