UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'e0UCrmravQgJggE74vFPTaMw8X2QjHUMMqxAXspOh0Q=' 
WHERE 
  key_id = 'de31682be6d58b64188625395fae37f4dee151987ba916f92576377c2f980d84' 
  AND (
    token = 'e0UCrmravQgJggE74vFPTaMw8X2QjHUMMqxAXspOh0Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051