UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7iwG6Dwvu7JJjv2XIIrFa8jzFEBC2R9+IBQQ9mJTJl8=' 
WHERE 
  key_id = 'd3fd9b11a6b9977b8b0e818be3aa73f87775cc351e407f84fbe6ee369391cfbf' 
  AND (
    token = '7iwG6Dwvu7JJjv2XIIrFa8jzFEBC2R9+IBQQ9mJTJl8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035