UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '18E3UJuPqFx5/4Lgziv4zMaozZ+5myGphG+Uh7esPzM=' 
WHERE 
  key_id = '83b1de317a751aa9a04efb1ee0df658c39fc474c0d225a3342daf07c97d9412e' 
  AND (
    token = '18E3UJuPqFx5/4Lgziv4zMaozZ+5myGphG+Uh7esPzM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051