UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'piAJYxjTD0bxCS/zbzEJMYG/KEd1yjDsOim5yMCTD8U=' 
WHERE 
  key_id = 'bf37b073c748d936163184c4e1eac750ce1c5fa4ba010420ee412b23e62e6229' 
  AND (
    token = 'piAJYxjTD0bxCS/zbzEJMYG/KEd1yjDsOim5yMCTD8U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00066