UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'zP8zAbmwoB7ScJ5HOeEP/cvBhTL3XgvkKcSbz7cLCpM=' 
WHERE 
  key_id = '90d9f779cc2b1adb63c0a42c88b23f870824c1541540be02e99902c0b96a1dff' 
  AND (
    token = 'zP8zAbmwoB7ScJ5HOeEP/cvBhTL3XgvkKcSbz7cLCpM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032