UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ns0nvXbLtLpgR2e1JympufmEF2EtM1WE4nlxr01KbGU=' 
WHERE 
  key_id = '032b79f77e29a50c0b877e3bf23dcec87892038202491ada9467e0f66cfcae02' 
  AND (
    token = 'Ns0nvXbLtLpgR2e1JympufmEF2EtM1WE4nlxr01KbGU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035