UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Zb+tpgBRWfsosHZ+7nLJaHWowen1peqyicMFUyDmwDY=' 
WHERE 
  key_id = '7dbd3e0891a13de54853da532fd2b285970754d2ac869b4763b75fa16bdd7065' 
  AND (
    token = 'Zb+tpgBRWfsosHZ+7nLJaHWowen1peqyicMFUyDmwDY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046