UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9Vddh7CmhtWUcT51jQqX/mSwoWipNklEaYdpQuKl3eY=' 
WHERE 
  key_id = 'daf4bd5828fa78c56a006df39fda9501466bb94608193de1e25bf2b925b4ad54' 
  AND (
    token = '9Vddh7CmhtWUcT51jQqX/mSwoWipNklEaYdpQuKl3eY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028