UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7NjtgEbjwJ9x3fFMv/nZJX5PsFBnaoK/E9MOBY586mI=' 
WHERE 
  key_id = '30b3d7f8aa3daef9e4cc5b914feac7f9f062f910730253e3e1c018248f01871b' 
  AND (
    token = '7NjtgEbjwJ9x3fFMv/nZJX5PsFBnaoK/E9MOBY586mI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037