UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'knnV4f0t+FmsPZc4MGSF7DzMH9DDxNtYDdn0rm5SmpM=' 
WHERE 
  key_id = '72d4708a813a6c1d9de753a25d58429d4007f06305de91ee9606745bf965f837' 
  AND (
    token = 'knnV4f0t+FmsPZc4MGSF7DzMH9DDxNtYDdn0rm5SmpM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00058