UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aIe92yohAYRbVlqbf8nynqVcl1Ybg6KrBH6OrA1sSq0=' 
WHERE 
  key_id = '74a16f210df92da2b7ab1a1352335585c99c7f355d747d290b4cdc0319f27172' 
  AND (
    token = 'aIe92yohAYRbVlqbf8nynqVcl1Ybg6KrBH6OrA1sSq0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026