UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gg9PMTtCFD20Wp/TwTWJBUrZhGxh5vyYyfFiicoDOkU=' 
WHERE 
  key_id = 'c2d71106a9771bb55f7dee13842f9f9d5279e0836bc3e2d7d943c1f54d6818ff' 
  AND (
    token = 'gg9PMTtCFD20Wp/TwTWJBUrZhGxh5vyYyfFiicoDOkU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018