UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PmUlcIwwy3BVRyxpEUEgTZiuC3qLmY/7WoRnBrbVy/U=' 
WHERE 
  key_id = 'bc723c76a720225e9dab7700b7da20feefd39f727fe635b486deb1ebd3e286d9' 
  AND (
    token = 'PmUlcIwwy3BVRyxpEUEgTZiuC3qLmY/7WoRnBrbVy/U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033