UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TyTD1UFXYi80ZeiKk812ybKyhUNl8O2zUGM0tLCwv+I=' 
WHERE 
  key_id = '2eb5f7d12e8dac744d7e45ee19b9fb35096d98045d4ed4e83473fc962000dcd5' 
  AND (
    token = 'TyTD1UFXYi80ZeiKk812ybKyhUNl8O2zUGM0tLCwv+I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043