UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'K1Ihw3y8wu/YaNqCbztzaie7rC3HHiqubHuBVEATP/w=' 
WHERE 
  key_id = '3c33df88e80fa7eb982ffb46dd611044a81f066726a79df1470df88521d814f7' 
  AND (
    token = 'K1Ihw3y8wu/YaNqCbztzaie7rC3HHiqubHuBVEATP/w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024