UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'txXGfw2RKCDkhofc9/k0QcAxQJNIL2agaSNvNlR6BbQ=' 
WHERE 
  key_id = '29a56a42b9975ce316daacdbc5f9873f6852985b74df91c6d3640f2e2799b212' 
  AND (
    token = 'txXGfw2RKCDkhofc9/k0QcAxQJNIL2agaSNvNlR6BbQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030