UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Z+vJZUt17ZVR+Bw8ZRmj3BUQbzGhZEXNwS8z9EAfx+U=' 
WHERE 
  key_id = 'f7bef64276f87743316dd944e728bbcc1178eccc60971d9574dfb34b9581d458' 
  AND (
    token = 'Z+vJZUt17ZVR+Bw8ZRmj3BUQbzGhZEXNwS8z9EAfx+U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040