UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Vyh2+xlBc+WDmf8uV5F8idJw4rZw/Atm/0Um75F5N+4=' 
WHERE 
  key_id = 'ab40a552f30f5e998b71a1a022b75cf3d20009faa1034a6694e6125f0f379410' 
  AND (
    token = 'Vyh2+xlBc+WDmf8uV5F8idJw4rZw/Atm/0Um75F5N+4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018